<script setup lang="ts">
import { defineProps } from 'vue'
/**
 * 获取计划详情
 * standard_price_template:标准模板(含价格)
 * standard_noprice_template:标准模板(不含价格)
 * front_bg_template:前置背景图模板
 * countdown_template:倒计时模板
 * postposition_questionnaire_template:后置问卷模板
 * group_template:团购模板
 */
// 接收父组件传递的templateInfo参数
const props = defineProps<{
  templateInfo?: any
}>()
const emit = defineEmits(['submit'])
const submit = async () => {
  emit('submit')
}
</script>

<template>
  <div class="fv">
    <div class="footerView">
      <div class="footer df">
        <div class="price" v-if="props.templateInfo?.templateStyle!='standard_noprice_template'">
          <b>{{props.templateInfo?.price||0}}</b>元 
          <span v-if="props.templateInfo?.showOriginalPrice">{{props.templateInfo?.originalPrice||0}}元</span>
        </div>
        <div class="btn" :class="{'pic':props.templateInfo?.templateStyle!='standard_noprice_template'}">
          <button @click="submit">{{props.templateInfo?.signupButtonText||'立即抢购'}}</button>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.fv {
  .footerView{
    position: fixed;
    bottom: 0;
    z-index: 10;
    width: 10rem;
    .footer{
      background:linear-gradient(0deg,#dcc9ab,#f8e9d0);
      display: flex;
      justify-content: space-between;
      align-items: center;
      .price{
        width: 4rem;
        font-size: 0.4rem;
        font-weight: 700;
        color: #5f3825;
        height: 1.4rem;
        line-height: 1.4rem;
        text-align: center;
        b{
          font-size: 1.2rem;
          color: #d32602;
        }
        span{
          font-size: 0.32rem;
          font-weight: 500;
          text-decoration: line-through;
          color: #5f3825;
        }
        
      }
      .btn{
        flex: 1;
        height: 1.4rem;
        button{
          width: 100%;
          cursor: pointer;
          background: #d32602;
          box-shadow: .02667rem .02667rem .21333rem 0 #f32f31;
          height: 1.4rem;
          line-height: 1.4rem;
          text-align: center;
          font-size: 0.7rem;
          font-weight: 700;
          color: #fff;
          animation: pulse 2s ease .2s infinite both;
          padding: 0;
          outline: none;
          border: 0;
          vertical-align: top;
          border-radius: 0;
        }
        &.pic button{
          border-radius: 0;
          border-top-left-radius:0.7rem;
          border-bottom-left-radius:0.7rem;
        }
      }
    }
  }
}

// 添加pulse动画定义
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

</style>